import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.*;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

import java.util.stream.Stream;
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class JunitTest02 {

    @Order(4)
    public static Stream<Arguments> Generator() {
        return Stream.of(Arguments.arguments(
                "1,张三",
                "2,李四"
        ));
    }

    @Order(5)
    @ParameterizedTest
    @ValueSource(ints = {9,8,7,4,5,6})
    void Test01(int num) {
        if (num >= 5) {
            System.out.println(num+"!");
        }
    }

    @Order(2)
    @ParameterizedTest
    @CsvSource({"1,2,3,6.12"})
    void Test02(int a,int b,int c,double d) {
        System.out.println(a+","+b+","+c+","+d);
    }

    @Order(3)
    @ParameterizedTest
    @CsvFileSource(resources = "test01.csv")
    void Test03(int num,String name) {
        System.out.println("学号:"+num+",姓名:"+name);
    }

    @Order(1)
    @ParameterizedTest
    @MethodSource("Generator")
    void Test04(String num,String name){
        WebDriver webDriver = new ChromeDriver();
        webDriver.get("https://www.bai.com/");
        System.out.println(num+","+name);
        Assertions.assertNotNull(webDriver);
    }
}
